package org.gap.web.jsf;

import java.util.List;

import org.gap.dao.EtablissementsBancairesDAO;
import org.gap.dao.GuichetsDAO;

import org.gap.domain.EtablissementsBancaires;
import org.gap.domain.Guichets;

import org.gap.service.GuichetsService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Component;

import org.springframework.transaction.annotation.Transactional;

/**
 * Spring Component that handles CRUD requests for Guichets entities
 * 
 */
@Scope("session")
@Component("GuichetsComponent")
public class GuichetsComponentImpl implements GuichetsComponent {

	/**
	 * Data type variable that provides CRUD operations for Guichets entities
	 * 
	 */
	private Guichets guichets;

	/**
	 * DAO injected by Spring that manages EtablissementsBancaires entities
	 * 
	 */
	private EtablissementsBancaires etablissementsbancaires;

	/**
	 * DAO injected by Spring that manages EtablissementsBancaires entities
	 * 
	 */
	@Autowired
	private EtablissementsBancairesDAO etablissementsBancairesDAO;

	/**
	 * DAO injected by Spring that manages Guichets entities
	 * 
	 */
	@Autowired
	private GuichetsDAO guichetsDAO;

	/**
	 * Service injected by Spring that provides CRUD operations for Guichets entities
	 * 
	 */
	@Autowired
	private GuichetsService guichetsService;

	/** 
	 */
	public GuichetsComponentImpl() {
	}

	/**
	 * Select the Guichets entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeleteGuichets(Integer guiEtablissementKey, Integer guiGuichetKey, String guiPaysKey) {
		guichets = guichetsDAO.findGuichetsByPrimaryKey(guiEtablissementKey, guiGuichetKey, guiPaysKey);

		return "/jsf/guichets/deleteGuichets.xhtml";
	}

	/**
	 * View an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String selectGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays, String related_etablissementsbancaires_etbPays, Integer related_etablissementsbancaires_etbEtablissement) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(related_etablissementsbancaires_etbPays, related_etablissementsbancaires_etbEtablissement, -1, -1);
		return "/jsf/guichets/etablissementsbancaires/viewEtablissementsBancaires.xhtml";
	}

	/**
	 * Get EtablissementsBancaires entity by Guichets
	 * 
	 */
	@Transactional
	public EtablissementsBancaires getGuichetsEtablissementsBancaires(Integer guiEtablissementKey, Integer guiGuichetKey, String guiPaysKey) {
		return guichetsDAO.findGuichetsByPrimaryKey(guiEtablissementKey, guiGuichetKey, guiPaysKey).getEtablissementsBancaires();
	}

	/**
	 * Create a new Guichets entity
	 * 
	 */
	@Transactional
	public String newGuichets() {
		guichets = new Guichets();

		return "/jsf/guichets/createGuichets.xhtml";
	}

	/**
	 * Save an existing Guichets entity
	 * 
	 */
	@Transactional
	public String saveGuichets(Guichets guichets) {
		guichetsService.saveGuichets(guichets);
		return "/jsf/guichets/listGuichetss.xhtml";
	}

	/**
	 * Save an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String saveGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays, EtablissementsBancaires etablissementsbancaires) {
		guichets = guichetsService.saveGuichetsEtablissementsBancaires(guichets_guiEtablissement, guichets_guiGuichet, guichets_guiPays, etablissementsbancaires);

		return "/jsf/guichets/viewGuichets.xhtml";
	}

	/**
	 * Select an existing Guichets entity
	 * 
	 */
	@Transactional
	public String selectGuichets(Integer guiEtablissementKey, Integer guiGuichetKey, String guiPaysKey) {
		guichets = guichetsDAO.findGuichetsByPrimaryKey(guiEtablissementKey, guiGuichetKey, guiPaysKey);

		return "/jsf/guichets/viewGuichets.xhtml";
	}

	/**
	 * Getter for variable Guichets
	 * 
	 */
	@Transactional
	public Guichets getGuichets() {
		return guichets;
	}

	/**
	 * Delete an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String deleteGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays, String related_etablissementsbancaires_etbPays, Integer related_etablissementsbancaires_etbEtablissement) {
		guichets = guichetsService.deleteGuichetsEtablissementsBancaires(guichets_guiEtablissement, guichets_guiGuichet, guichets_guiPays, related_etablissementsbancaires_etbPays, related_etablissementsbancaires_etbEtablissement);

		return "/jsf/guichets/viewGuichets.xhtml";
	}

	/**
	 * Edit an existing Guichets entity
	 * 
	 */
	@Transactional
	public String editGuichets(Integer guiEtablissementKey, Integer guiGuichetKey, String guiPaysKey) {
		guichets = guichetsDAO.findGuichetsByPrimaryKey(guiEtablissementKey, guiGuichetKey, guiPaysKey);

		return "/jsf/guichets/editGuichets.xhtml";
	}

	/**
	 * Getter for variable Guichets
	 * 
	 */
	@Transactional
	public EtablissementsBancaires getEtablissementsbancaires() {
		return etablissementsbancaires;
	}

	/**
	 * Show all Guichets entities
	 * 
	 */
	@Transactional
	public List<Guichets> listGuichetss() {
		return new java.util.ArrayList<Guichets>(guichetsService.loadGuichetss());
	}

	/**
	 * Create a new EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String newGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays) {
		etablissementsbancaires = new EtablissementsBancaires();

		return "/jsf/guichets/etablissementsbancaires/createEtablissementsBancaires.xhtml";
	}

	/**
	 * Edit an existing EtablissementsBancaires entity
	 * 
	 */
	@Transactional
	public String editGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays, String related_etablissementsbancaires_etbPays, Integer related_etablissementsbancaires_etbEtablissement) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(related_etablissementsbancaires_etbPays, related_etablissementsbancaires_etbEtablissement, -1, -1);
		return "/jsf/guichets/etablissementsbancaires/editEtablissementsBancaires.xhtml";
	}

	/**
	 * Select the child EtablissementsBancaires entity for display allowing the user to confirm that they would like to delete the entity
	 * 
	 */
	@Transactional
	public String confirmDeleteGuichetsEtablissementsBancaires(Integer guichets_guiEtablissement, Integer guichets_guiGuichet, String guichets_guiPays, String related_etablissementsbancaires_etbPays, Integer related_etablissementsbancaires_etbEtablissement) {
		etablissementsbancaires = etablissementsBancairesDAO.findEtablissementsBancairesByPrimaryKey(related_etablissementsbancaires_etbPays, related_etablissementsbancaires_etbEtablissement);

		return "/jsf/guichets/etablissementsbancaires/deleteEtablissementsBancaires.xhtml";
	}

	/**
	 * Delete an existing Guichets entity
	 * 
	 */
	@Transactional
	public String deleteGuichets(Integer guiEtablissementKey, Integer guiGuichetKey, String guiPaysKey) {
		Guichets guichets = guichetsDAO.findGuichetsByPrimaryKey(guiEtablissementKey, guiGuichetKey, guiPaysKey);
		guichetsService.deleteGuichets(guichets);
		return "/jsf/guichets/listGuichetss.xhtml";
	}

}
